

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>Ceph 对象网关快速入门 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/underscore.js"></script>
        <script src="../../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../../genindex/" />
    <link rel="search" title="Search" href="../../../search/" />
    <link rel="next" title="升级 Ceph" href="../upgrading-ceph/" />
    <link rel="prev" title="CephFS 快速入门" href="../quick-cephfs/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../../">安装 Ceph</a> &raquo;</li>
        
          <li><a href="../">安装 (ceph-deploy)</a> &raquo;</li>
        
      <li>Ceph 对象网关快速入门</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../../_sources/install/ceph-deploy/quick-rgw.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../../">
          

          
            
            <img src="../../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../">安装 Ceph</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../#id1">建议的方法</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../../#id2">其他方法</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../../index_manual/">安装（手动）</a></li>
<li class="toctree-l3 current"><a class="reference internal" href="../">安装 (ceph-deploy)</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="../quick-start-preflight/">Preflight</a></li>
<li class="toctree-l4"><a class="reference internal" href="../quick-ceph-deploy/">Storage Cluster Quick Start</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../start/quick-rbd/">Block Device Quick Start</a></li>
<li class="toctree-l4"><a class="reference internal" href="../quick-cephfs/">Filesystem Quick Start</a></li>
<li class="toctree-l4 current"><a class="current reference internal" href="#">Object Storage Quick Start</a></li>
<li class="toctree-l4"><a class="reference internal" href="../upgrading-ceph/">升级 Ceph</a></li>
<li class="toctree-l4"><a class="reference internal" href="../install-ceph-gateway/">    安装 Ceph 对象网关</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="ceph">
<h1>Ceph 对象网关快速入门<a class="headerlink" href="#ceph" title="Permalink to this headline">¶</a></h1>
<p>从 <cite>firefly</cite> (v0.80) 起， Ceph 存储系统极大地简化了 Ceph 对象网关的安装和配置；网关守护进程内嵌了 Civetweb ，这样你就无需再安装网页服务器或配置 FastCGI 了。另外， <code class="docutils literal notranslate"><span class="pre">ceph-deploy</span></code> 也能帮你安装网关软件包、生成密钥、配置数据目录、创建网关例程。</p>
<div class="admonition tip">
<p class="admonition-title">Tip</p>
<p>Civetweb 默认使用 <code class="docutils literal notranslate"><span class="pre">7480</span></code> 端口，所以你得开放 <code class="docutils literal notranslate"><span class="pre">7480</span></code> 端口、或者在 Ceph 配置文件里设置想要的端口号（如
<code class="docutils literal notranslate"><span class="pre">80</span></code> 端口）。</p>
</div>
<p>下面我们开始 Ceph 对象网关之旅：</p>
<div class="section" id="id1">
<h2>安装 Ceph 对象网关<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h2>
<ol class="arabic">
<li><p>在 <code class="docutils literal notranslate"><span class="pre">client-node</span></code> 节点上执行安装前的准备工作。如果就用
Civetweb 的默认端口 <code class="docutils literal notranslate"><span class="pre">7480</span></code> ，你得用 <code class="docutils literal notranslate"><span class="pre">firefly-cmd</span></code> 或
<code class="docutils literal notranslate"><span class="pre">iptables</span></code> 先开放这个端口，详情见<a class="reference external" href="../quick-start-preflight">飞前检查</a>。</p></li>
<li><p>在你管理服务器上的工作目录下，把 Ceph 对象网关软件包装进
<code class="docutils literal notranslate"><span class="pre">client-node</span></code> 节点。例如：:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span><span class="o">-</span><span class="n">deploy</span> <span class="n">install</span> <span class="o">--</span><span class="n">rgw</span> <span class="o">&lt;</span><span class="n">client</span><span class="o">-</span><span class="n">node</span><span class="o">&gt;</span> <span class="p">[</span><span class="o">&lt;</span><span class="n">client</span><span class="o">-</span><span class="n">node</span><span class="o">&gt;</span> <span class="o">...</span><span class="p">]</span>
</pre></div>
</div>
</li>
</ol>
</div>
<div class="section" id="id2">
<h2>创建这个 Ceph 对象网关例程<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h2>
<p>在你管理服务器上的工作目录下，创建 Ceph 对象网关例程到
<code class="docutils literal notranslate"><span class="pre">client-node</span></code> 节点上。例如：:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span><span class="o">-</span><span class="n">deploy</span> <span class="n">rgw</span> <span class="n">create</span> <span class="o">&lt;</span><span class="n">client</span><span class="o">-</span><span class="n">node</span><span class="o">&gt;</span>
</pre></div>
</div>
<p>这个网关开始运行后，你应该就能通过 <code class="docutils literal notranslate"><span class="pre">7480</span></code> 端口访问了。（如
<code class="docutils literal notranslate"><span class="pre">http://client-node:7480</span></code> ）。</p>
</div>
<div class="section" id="id3">
<h2>配置这个 Ceph 对象网关例程<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h2>
<ol class="arabic">
<li><p>要更改默认端口（如改为 <code class="docutils literal notranslate"><span class="pre">80</span></code> ），可修改 Ceph 配置文件。增加一段名为 <code class="docutils literal notranslate"><span class="pre">[client.rgw.&lt;client-node&gt;]</span></code> 的配置，把其中的
<code class="docutils literal notranslate"><span class="pre">&lt;client-node&gt;</span></code> 改为你的 Ceph 客户端节点的短主机名（即 <code class="docutils literal notranslate"><span class="pre">hostname</span> <span class="pre">-s</span></code> ）。例如，假设你的节点名为 <code class="docutils literal notranslate"><span class="pre">client-node</span></code> ，就在 <code class="docutils literal notranslate"><span class="pre">[global]</span></code> 段之后新增：:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">client</span><span class="o">.</span><span class="n">rgw</span><span class="o">.</span><span class="n">client</span><span class="o">-</span><span class="n">node</span><span class="p">]</span>
<span class="n">rgw_frontends</span> <span class="o">=</span> <span class="s2">&quot;civetweb port=80&quot;</span>
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>在 <code class="docutils literal notranslate"><span class="pre">rgw_frontends</span></code> 键值对里面，切记不要在 <code class="docutils literal notranslate"><span class="pre">port=&lt;port-number&gt;</span></code> 之中加空格。</p>
</div>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>如果你想用 80 端口，需确保没运行 Apache 服务器，否则它会与 Civetweb 冲突。这种情况下，我们建议您卸载
Apache 。</p>
</div>
</li>
<li><p>要使配置生效，需重启 Ceph 对象网关。在 Red Hat Enterprise
Linux 7 和 Fedora 上可用下列命令：:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">systemctl</span> <span class="n">restart</span> <span class="n">ceph</span><span class="o">-</span><span class="n">radosgw</span><span class="o">.</span><span class="n">service</span>
</pre></div>
</div>
<p>在 Red Hat Enterprise Linux 6 和 Ubuntu 上可用下列命令：:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">service</span> <span class="n">radosgw</span> <span class="n">restart</span> <span class="nb">id</span><span class="o">=</span><span class="n">rgw</span><span class="o">.&lt;</span><span class="n">short</span><span class="o">-</span><span class="n">hostname</span><span class="o">&gt;</span>
</pre></div>
</div>
</li>
<li><p>最后，确保你选用的端口在此节点的防火墙上（如 <code class="docutils literal notranslate"><span class="pre">80</span></code> 端口）已开放。如果没开放，就加上这个端口、然后重载下防火墙配置。例如：:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">firewall</span><span class="o">-</span><span class="n">cmd</span> <span class="o">--</span><span class="nb">list</span><span class="o">-</span><span class="nb">all</span>
<span class="n">sudo</span> <span class="n">firewall</span><span class="o">-</span><span class="n">cmd</span> <span class="o">--</span><span class="n">zone</span><span class="o">=</span><span class="n">public</span> <span class="o">--</span><span class="n">add</span><span class="o">-</span><span class="n">port</span> <span class="mi">80</span><span class="o">/</span><span class="n">tcp</span> <span class="o">--</span><span class="n">permanent</span>
<span class="n">sudo</span> <span class="n">firewall</span><span class="o">-</span><span class="n">cmd</span> <span class="o">--</span><span class="n">reload</span>
</pre></div>
</div>
<p>关于用 <code class="docutils literal notranslate"><span class="pre">firewall-cmd</span></code> 或 <code class="docutils literal notranslate"><span class="pre">iptables</span></code> 配置防火墙的详情见<a class="reference external" href="../quick-start-preflight">飞前检查</a>。</p>
<p>现在，你应该能发起未经认证的请求、并收到响应了。例如，发出一个类似下面的无参数请求：:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">http</span><span class="p">:</span><span class="o">//&lt;</span><span class="n">client</span><span class="o">-</span><span class="n">node</span><span class="o">&gt;</span><span class="p">:</span><span class="mi">80</span>
</pre></div>
</div>
<p>应该会收到这样的响应：:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;ListAllMyBucketsResult xmlns=&quot;http://s3.amazonaws.com/doc/2006-03-01/&quot;&gt;
  &lt;Owner&gt;
    &lt;ID&gt;anonymous&lt;/ID&gt;
    &lt;DisplayName&gt;&lt;/DisplayName&gt;
  &lt;/Owner&gt;
    &lt;Buckets&gt;
  &lt;/Buckets&gt;
&lt;/ListAllMyBucketsResult&gt;
</pre></div>
</div>
</li>
</ol>
<p>其它管理和 API 方面的详情可参考 <a class="reference external" href="../../../radosgw/config-ref">Ceph 对象网关的配置</a>手册。</p>
</div>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../upgrading-ceph/" class="btn btn-neutral float-right" title="升级 Ceph" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../quick-cephfs/" class="btn btn-neutral float-left" title="CephFS 快速入门" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>